<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <input type="text" v-model="n" /> + 
    <input type="text" v-model="m" />
    <input type="button" value="=" v-on:click="sumFn"/>
    {{result}}
  </div>
  <script src="./vue.js"></script>
  <script>
    new Vue({
      el: '#app',
      data: {
        n: '2',
        m: '3',
        result: '5'
      },
      methods: {
        // sumFn: function() {
        // },

        sumFn() {  // es6 新增语法糖
          this.result = parseInt(this.n) + parseInt(this.m)
        }
      }
    })
  </script>
</body>
</html>